<?
$str="select account from pft_member where id=$memberID";
$GLOBALS['le']->query($str);
$GLOBALS['le']->fetch_assoc();
$account=$GLOBALS['le']->f("account");
?>
<title><?=$v['title']?></title>
<script src="js/ui/PopWindow.js" type="text/javascript"></script>
<script src="js/Calendar.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="css/default.css"/>
<link rel="stylesheet" type="text/css" href="css/page.css"/>
<link rel="stylesheet" type="text/css" href="css/sell_product.css"/>
<div class="content">
	<h3 class="mc_title">
		<span class="mctit_1"><span class="mctit_2"><?=$v['title']?></span></span>
	</h3>
	<div class="mcsear_box">
		<form action="" class="report">
			<input type="hidden" name="act" id="act" />
			<input type="hidden" name="atype" value="<?=$atype?>" />
			<input type="hidden" name="currentPage" value="<?=$currentPage?>"/>
			<input type="hidden" name="status" id="status" value="<?=$_REQUEST['status']?>"/>
			<ul class="search">
				<li>
					<span>
						<label>查询条件：</label>
						<select name="tjs">
							<option value="">--请选择--</option>
							<option <?=$_REQUEST['tjs']=="0"?"selected":""?> value="0">订单号</option>
							<option <?=$_REQUEST['tjs']=="1"?"selected":""?> value="1">产品名称</option>
							<option <?=$_REQUEST['tjs']=="2"?"selected":""?> value="2">取票人姓名</option>
							<option <?=$_REQUEST['tjs']=="3"?"selected":""?> value="3">取票人手机</option>
							<?if($v['from']!="buy"){?>
							<option <?=$_REQUEST['tjs']=="4"?"selected":""?> value="4">分销商名称</option>
							<?}?>
							<?if($v['from']=="buy"||$_SESSION['dtype']==9){?>
							<option <?=$_REQUEST['tjs']=="5"?"selected":""?> value="5">供应商名称</option>
							<?}?>
							<option <?=$_REQUEST['tjs']=="6"?"selected":""?> value="6">远端订单号</option>
						</select>
						<input type="text" name="txt"  class="inputText svalue" value="<?=$_REQUEST['txt']?>"/>
					</span>
					<span>
						<label>支付方式：</label>
						<input type="checkbox" name="payinfo[]" <?=(in_array(0,$_REQUEST['payinfo']))?"checked":""?> value="0" />
						<label for="mck1">账户余额</label>
						<input type="checkbox" name="payinfo[]" <?=(in_array(1,$_REQUEST['payinfo']))?"checked":""?> value="1"/>
						<label for="mck2">支付宝</label>
						<input type="checkbox" name="payinfo[]" <?=(in_array(2,$_REQUEST['payinfo']))?"checked":""?> value="2"/>
						<label for="mck3">授信支付</label>
					</span>
					<span>
						<input type="submit" class="sbtn" value=""/>

					</span>
				</li>
				<li>
					<span>
						<label>订单时间：</label>
						<select class="" name="xtimes">
							<option <?=$_REQUEST['xtimes']=="1"?"selected":""?> value="1">--下单时间-</option>
							<option <?=$_REQUEST['xtimes']=="2"?"selected":""?> value="2">--预计游玩-</option>
							<option <?=$_REQUEST['xtimes']=="3"?"selected":""?> value="3">--完成时间-</option>	
						</select>
						<input type="text" name="begintime" readOnly onmouseup="SelectDate(this,'yyyy-MM-dd',0,0)"  class="inputText time" value="<?=$_REQUEST['begintime']?>"/>
						<label>至</label>
						<input type="text" name="endtime" readOnly onmouseup="SelectDate(this,'yyyy-MM-dd',0,0)" class="inputText time" value="<?=$_REQUEST['endtime']?>"/>
					</span>
					<span>
						<label>搜索排序：</label>
						<select name="orderby">
							<option value="">--请选择--</option>
							<option <?=$_REQUEST['orderby']=="1"?"selected":""?> value="1" >-下单时间-</option>
							<option <?=$_REQUEST['orderby']=="2"?"selected":""?> value="2" >-游玩时间-</option>
							<option <?=$_REQUEST['orderby']=="3"?"selected":""?> value="3" >-验证时间-</option>
							<option <?=$_REQUEST['orderby']=="5"?"selected":""?> value="5" >-产品标题-</option>
						</select>
						<select name="sort">
							<option <?=$_REQUEST['sort']=="1"?"selected":""?> value="1" >-降序-</option>
							<option <?=$_REQUEST['sort']=="0"?"selected":""?> value="0" >-升序-</option>
						</select>
					</span>
					<input type="button" id="excel" class="btn" value="导 出"/>
					<style type="text/css">
					.btn{padding: 4px 15px;background: url("images/mc_title.png") no-repeat right top;color: #fff;border: none;cursor: pointer;}
					</style>
				</li>
			</ul>
		</form>
		<ul class="mcul">
			<li class="<?=!isset($_REQUEST['status'])||$_REQUEST['status']===""?"acrt":""?>"><a href="#" status="" >所有订单</a></li>
			<li class="<?=$_REQUEST['status']=="1"?"acrt":""?>"><a href="#" status="1" >已使用</a></li>
			<li class="<?=$_REQUEST['status']=="0"?"acrt":""?>"><a href="#" status="0" >未使用</a></li>
			<li class="<?=$_REQUEST['status']=="2"?"acrt":""?>"><a href="#" status="2" >已过期</a></li>
			<li class="<?=$_REQUEST['status']=="3"?"acrt":""?>"><a href="#" status="3" >已取消</a></li>
		</ul>
	</div>
   <div class="mc_ordlist">
		<table class="mclist_tab">
			<thead>
				<tr class="thead1">
					<td class="frish">缩略图</td>
					<td>类别</td>
					<td>票类单号</td>
					<td>产品名称</td>
					<td>单价(元)</td>
					<td>数量</td>
					<td>支付方式</td>
					<td>订单状态</td>
					<td>总金额(元)</td>
					<td class="last">订单操作</td>
				</tr>
				<tr class="kong10"><td></td></tr>
				<tr class="thead2">
					<td colspan="10">
						<div id="topPage">
						<?page($count,$currentPage,$pageSize,$order,$by);?>
						</div>
					</td>
				</tr>
			</thead>
			<?foreach($r as $row){?>
			<tbody>
				<tr class="kong10"><td></td></tr>
				<tr class="tbody1">
					<td colspan="10">
					   <!--  <input type="checkbox" class="orderck" /> -->
					   <div style="width:3em;float:left">&nbsp;</div>
						<div class="tbody_div">
							<span>订单编号：<a target="_blank" href="orderView.html?ordernum=<?=$row['mainOrder']->UUordernum?>" class="ordernb"><?=(string)$row['mainOrder']->UUordernum?></a></span>
							<span>下单时间：<?=(string)$row['mainOrder']->UUordertime?></span>
							<span>预计游玩：<?=(string)$row['mainOrder']->UUbegintime?></span>
							<span>完成时间：<?=(string)$row['mainOrder']->UUdtime!="0000-00-00 00:00:00"?(string)$row['mainOrder']->UUdtime:"未验证"?></span><br />
							<?if($v['from']!="buy"&&$_SESSION['sdtype']!=2){//echo (int)$row['mainOrder']->fid;?>
							<span>分销商：<?=$fnames[(int)$row['mainOrder']->fid]?$fnames[(int)$row['mainOrder']->fid]:(string)$row['mainOrder']->UUdname?></span>
							<?}?>
							<?if($v['from']=="buy"||$_SESSION['sdtype']==9){?>
							<span>供应商：<?=$anames[(string)$row['mainOrder']->UUaid];echo $row['mainOrder']->UUaid?></span>
							<?}?>
							<span>取票人：<?=(string)$row['mainOrder']->UUordername?></span>
							<span>手机：<?=(string)$row['mainOrder']->UUordertel?></span>
							<?if((string)$row['mainOrder']->UUremotenum){?>
							<span>远端订单号：<?=(string)$row['mainOrder']->UUremotenum?></span>
							<?}?>
						</div>
					</td>
				</tr>
				<tr class="tbody2">
					<td  rowspan="<?=$row['totalOrder']?>" class="frish"><img width="81" src="<?=$images[(string)$row['mainOrder']->UUlid]?>" /></td>
					<td rowspan="<?=$row['totalOrder']?>"><?=OrderRecord::$p_typeT[(string)$row['mainOrder']->UUp_type]?></td>
					<td><?=$row['mainOrder']->UUordernum?></td>
					<td class="title"><?=(string)$row['mainOrder']->UUltitle?><?=(string)$row['mainOrder']->UUttitle?></td>
					<td class="tprice"><i class="money">￥</i><?=(string)$row['mainOrder']->UUtprice/100?></td>
					<td class="tnum"><?=(string)$row['mainOrder']->UUtnum?></td>
					<td rowspan="<?=$row['totalOrder']?>">
						<?=OrderRecord::$paymodeT[(string)$row['mainOrder']->UUpmode]?>
						<?if($row['mainOrder']->UUordermode!=0){?>
						</br><em class="fuchsia">(游客预订)</em>
						<?}?>
					</td>
					<td rowspan="<?=$row['totalOrder']?>">
						<?=OrderRecord::$statusT[(string)$row['mainOrder']->UUstatus]?>
						<?if($row['mainOrder']->UUstatus==0){?>
						</br><?=OrderRecord::$paystatusT[(string)$row['mainOrder']->UUpaystatus]?>
						<?}?>
					</td>
					<td rowspan="<?=$row['totalOrder']?>">
						<span class="money"><i class="money">￥</i><?=(string)$row['totalPrice']/100?></span>
					</td>
					<td class="last" rowspan="<?=$row['totalOrder']?>">
						<?//($row['mainOrder']->SecondHand==1)?"(转供应订单)":""?>
						<?if(OrderRecord::orderOperAuth($row,$memberID,$account,"orderView")){?>
						<a target="_blank" href="orderView.html?from=<?=$v['from']?>&ordernum=<?=$row['mainOrder']->UUordernum?>">查看</a></br>
						<?}?>
						<?if(OrderRecord::orderOperAuth($row,$memberID,$account,"orderAlipay")){?>
						<a target="_blank" href="alipayOrder.html?ordernum=<?=(string)$row['mainOrder']->UUordernum?>">支付</a></br>
						<?}?>
						<?if(OrderRecord::orderOperAuth($row,$memberID,$account,"orderCancel")){?>
						<a act="cancel" class="orderHandle" href="call/handle.php?from=order_cancel&&ordernum=<?=(string)$row['mainOrder']->UUordernum?>">取消</a></br>
						<?}?>
						<?if(OrderRecord::orderOperAuth($row,$memberID,$account,"orderResend")){?>
						<a act="cancel" class="resend" href="call/handle.php?from=order_resend&&ordernum=<?=(string)$row['mainOrder']->UUordernum?>">重发</a></br>
						<?}?>
						<?if(OrderRecord::orderOperAuth($row,$memberID,$account,"orderAlter")){?>
						<a  class="alter" href="call/handle.php?from=orderAlterHtml&&ordernum=<?=(string)$row['mainOrder']->UUordernum?>">修改</a></br>
						<?}?>
					</td>
				</tr>
				<?foreach($row['childOrder'] as $c_order){?>
				<tr class="tbody2">
					<td><?=$c_order->UUordernum?></td>
					<td class="title"><?=(string)$c_order->UUltitle?><?=(string)$c_order->UUttitle?></td>
					<td class="tprice"><i class="money">￥</i><?=(string)$c_order->UUtprice/100?></td>
					<td class="tnum"><?=(string)$c_order->UUtnum?></td>
				</tr>
				<?}?>
			</tbody>
			<?}?>
			<!-- <tfoot class="tfoot1">
				<td colspan="10">
					<div class="">
					</div>
					<!-- <label for="chkall2"><input type="checkbox" class="mchck" id="chkall2" />全选</label>
					<input type="button" class="thedbtn" value="批量验证订单" /> 
				</td>
			</tfoot> -->
		</table>	
		<?page($count,$currentPage,$pageSize,$order,$by);?>
   </div>
</div>
<script>
	var popWindow=new PopWindow();
	$(".alter").click(function(){
		$.ajax({
			"url":$(this).attr("href"),
			"success":function(data){
				popWindow.open(data);
				$("form.changetnum input.cancel").click(function(){
					popWindow.close();
				});
				$("form.changetnum").submit(function(){
					popWindow.close();
					var str=$(this).serialize();
					$.ajax({
						"url":"call/handle.php?from=order_alter&"+str,
						"dataType":"json",
						"success":function(data){
							if(data.outcome==1){
								alert(data.msg);
								window.location=window.location.href;
							}else{
								alert(data.msg);
							}
						}
					});
					return false;
				});
				
			}
		})
		return false;
	});
	$(".orderHandle").click(function(){
		if($(this).attr("act")=="cancel"){
			if(!confirm("确定要取消该订单？")) return false;
		}
		$.ajax({
			"url":$(this).attr("href"),
			"dataType":"json",
			"success":function(data){
				if(data.outcome==1){
					alert("取消成功");
					window.location=window.location.href;
					/*$(this).parent().prev().prev().html('<em class="red">已取消</em>');
					var textT=$(this).find("a").first().text();
					$(this).parent().html(textT);*/
				}else{
					alert("取消失败"+data.msg);
				}
			}
		})
		return false;
	});
	$(".resend").click(function(){
		if($(this).attr("act")=="cancel"){
			if(!confirm("确定要重发短信？")) return false;
		}
		$.ajax({
			"url":$(this).attr("href"),
			"dataType":"json",
			"success":function(data){
				if(data.outcome==1){
					alert("重发成功");
				}else{
					alert("重发失败:"+data.msg);
				}
			}
		})
		return false;
	});
	$(".mcul li a").click(function(){
		$("#status").val($(this).attr("status"));
		$(".sbtn").click();
		return false;
	})
	
	$("#excel").click(function(){
		$("#act").val("Export");
		$("form.report").submit();
		$("#act").val("");
	});

</script>
